home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / show / gs_src_gs.lha / gs5.03 / gdevpstr.h < prev    next >
C/C++ Source or Header  |  1997-02-19  |  3KB  |  74 lines

  1. /* Copyright (C) 1997 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gdevpstr.h */
  20. /* Stream output for PostScript- and PDF-writing drivers. */
  21.  
  22. /* Define an opaque type for streams. */
  23. #ifndef stream_DEFINED
  24. #  define stream_DEFINED
  25. typedef struct stream_s stream;
  26. #endif
  27.  
  28. /* Put a character on a stream. */
  29. #define pputc(s, c) spputc(s, c)
  30.  
  31. /* Put a byte array on a stream. */
  32. int pwrite(P3(stream *s, const void *ptr, uint count));
  33.  
  34. /* Put a string on a stream. */
  35. int pputs(P2(stream *s, const char *str));
  36.  
  37. /*
  38.  * Print (a) floating point number(s) using a format.  This is needed
  39.  * because %f format always prints a fixed number of digits after the
  40.  * decimal point, and %g format may use %e format, which PDF disallows.
  41.  * These functions return a pointer to the next %-element of the format, or
  42.  * to the terminating 0.
  43.  */
  44. const char *pprintg1(P3(stream *s, const char *format, floatp v));
  45. const char *pprintg2(P4(stream *s, const char *format, floatp v1, floatp v2));
  46. #define pprintg3(s, format, v1, v2, v3)\
  47.   pprintg2(s, pprintg1(s, format, v1), v2, v3)
  48. const char *pprintg4(P6(stream *s, const char *format, floatp v1, floatp v2,
  49.             floatp v3, floatp v4));
  50. #define pprintg6(s, format, v1, v2, v3, v4, v5, v6)\
  51.   pprintg2(s, pprintg4(s, format, v1, v2, v3, v4), v5, v6)
  52.  
  53. /* Print (an) int value(s) using a format. */
  54. const char *pprintd1(P3(stream *s, const char *format, int v));
  55. const char *pprintd2(P4(stream *s, const char *format, int v1, int v2));
  56. #define pprintd3(s, format, v1, v2, v3)\
  57.   pprintd1(s, pprintd2(s, format, v1, v2), v3)
  58. #define pprintd4(s, format, v1, v2, v3, v4)\
  59.   pprintd2(s, pprintd2(s, format, v1, v2), v3, v4)
  60.  
  61. /* Print a long value using a format. */
  62. const char *pprintld1(P3(stream *s, const char *format, long v));
  63. #define pprintld2(s, format, v1, v2)\
  64.   pprintld1(s, pprintld1(s, format, v1), v2)
  65. #define pprintld3(s, format, v1, v2, v3)\
  66.   pprintld2(s, pprintld1(s, format, v1), v2, v3)
  67.  
  68. /* Print (a) string(s) using a format. */
  69. const char *pprints1(P3(stream *s, const char *format, const char *str));
  70. const char *pprints2(P4(stream *s, const char *format, const char *str1,
  71.             const char *str2));
  72. #define pprints3(s, format, str1, str2, str3)\
  73.   pprints2(s, pprints1(s, format, str1), str2, str3)
  74.